<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<html>
<head>
	<link rel="stylesheet" href="${ctx}/static/css/jquery-ui.min.css" />
	<title>订单列表</title>
	<script src="${ctx}/static/js/jquery-ui.min.js"></script>
    <script>
            function deleteOrder(id){
                $.ajax({
                    type:'get',
                    url:'${ctx}/api/v1/order/delete',
                    data:{'id':id},
                    success:function(data) {
                        console.log(data);
                        if(data.resCode==1){
                            alert("删除成功!");
                            location.reload();
                            return;
                        }else{
                            alert("后台出现未知错误，请联系维护人员!");
                            return;
                        }
                    }
                });
            }
   </script>
</head>

<body>	
	
	<div class="main-content-inner">
		<!-- #section:basics/content.breadcrumbs -->
		<div class="breadcrumbs" id="breadcrumbs">
			<script type="text/javascript">
				try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
			</script>
	
			<ul class="breadcrumb">
				<li>
					<i class="ace-icon fa fa-home home-icon"></i>
					<a href="${ctx}/welcome">主页</a>
				</li>
				<li class="active">订单列表</li>
			</ul><!-- /.breadcrumb -->
	
			<!-- #section:basics/content.searchbox -->
			<div class="nav-search" id="nav-search">
				<form class="form-search" action="${ctx}/order/list" method="GET">
<!-- 					<span class="input-icon"> -->
<%-- 						<input type="text" autocomplete="off" name="search_LIKE_user.name" placeholder="姓名 ..." class="nav-search-input" id="nav-search-input" autocomplete="off" value="${param['search_LIKE_user.name']}" /> --%>
<!-- 						<i class="ace-icon fa fa-search nav-search-icon" onclick="$('.form-search').submit();"></i> -->
<!-- 					</span> -->
					<span class="input-icon">
						<input type="text" autocomplete="off" name="search_EQ_id" placeholder="订单号 ..." class="nav-search-input" id="nav-search-input" autocomplete="off" value="${param['search_EQ_id']}" />
						<i class="ace-icon fa fa-search nav-search-icon" onclick="$('.form-search').submit();"></i>
					</span>
					<input type="button" value="搜索" onclick = "$('.form-search').submit();" />
				</form>
			</div><!-- /.nav-search -->
	
			<!-- /section:basics/content.searchbox -->
		</div>	
		<!-- /section:basics/content.breadcrumbs -->
		
		<div class="page-content">
			
			<c:if test="${not empty message}">
				<div id="message" class="alert alert-success"><button data-dismiss="alert" class="close">×</button>${message}</div>
			</c:if>	
			
			<div class="page-header">
				<h1>
					订单
					<small>
						<i class="ace-icon fa fa-angle-double-right"></i>
						信息列表
					</small>
				</h1>
				
			</div><!-- /.page-header -->			
			
			<div class="row">
				<div class="col-xs-12">
					<!-- PAGE CONTENT BEGINS -->
					
					<table id="sample-table-1" class="table table-striped table-bordered table-hover">
						<thead>
							<tr>
								<th>捐赠标题</th>
								<th>捐赠内容</th>
								<th>捐赠号</th>
                                <th>联系电话</th>
                                <th>募捐数额</th>
								<th>募捐计划单数</th>
								<th>已募捐单数</th>
                                <th>创建时间</th>
								<th>操作</th>
							</tr>
						</thead>

						<tbody>
							<c:forEach items="${orders.content}" var="order">
							<tr>
								<td>
									${order.title}
								</td>
								<td>
									${order.oDesp}
								</td>
                                <td>
                                    ${order.id}
                                </td>
                                <td>
                                    ${order.authTel}
                                </td>
                                <td>
                                    ${order.amount}
                                </td>
                                <td>
                                    ${order.targetNum}
                                </td>
                                <td>
                                    ${order.realNum}
                                </td>
                                <td>
                                    <fmt:formatDate value="${order.createtime}" pattern="yyyy-MM-dd  HH:mm:ss" />
                                </td>
								<td align="left">
										<a class="btn btn-xs btn-danger" href="javaScript:deleteOrder(${order.id});">
											删除
										</a>
                                        <a class="btn btn-xs btn-danger" href="${ctx}/order/update?id=${order.id}">
                                            更新
                                        </a>
								</td>
							</tr>
							</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
			<tags:pagination page="${orders}" paginationSize="5"/>
		</div><!-- /.page-content -->
	</div>
</body>
</html>
<!-- inline scripts related to this page -->	
